package com.ruoyi.health.report.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.health.report.api.RemoteGlossoscopyService;
import com.ruoyi.health.report.domain.GlossoscopyVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;
@Component
public class RemoteGlossoscopyFallbackFactory implements FallbackFactory<RemoteGlossoscopyService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteGlossoscopyFallbackFactory.class);

    @Override
    public RemoteGlossoscopyService create(Throwable throwable) {
        log.error("舌诊服务调用失败:{}", throwable.getMessage());
        return new RemoteGlossoscopyService() {
            @Override
            public R<GlossoscopyVO> xushiFaceBase64(Map<String, String> map) {
                return  R.fail("舌诊服务调用失败:" + throwable.getMessage());
            }
        };
    }
}
